The invention relates to a sensor assembly for detecting the position of a magnet which is movable in relation to the sensor assembly, with a sensor housing, in which a sensor element sensitive to magnetic fields is arranged, it being possible to generate a digital output signal, the switching state of which is dependent on the relative position between the sensor element and the magnet.
Sensor assemblies of this type are used, for example, to detect the position of a piston ring of a pneumatic cylinder through the nonmagnetic cylinder wall. When the piston approaches the sensor element, the output jumps into another switching state, that is to say the digital switching state indicates whether or not the piston has approached the sensor element.